/**
 * DictionaryController.java
 * Version 1.0.0
 * Created on 2018年9月14日
 *
 */
package com.yincheng.oes.business.util.dictionary;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2018年9月14日
 * <p>
 * 功能描述：字典数据controller层
 * <p>
 * 邮箱地址：446948434@qq.com
 */
@Controller
@RequestMapping("/dictionay")
public class DictionaryController {

    @Autowired
    private DictionaryService dictionaryService;

    @RequestMapping(value = "/getByModel.json", method = RequestMethod.GET)
    @ResponseBody
    public List<Dictionary> getByModel(String model) {
        List<Dictionary> list = dictionaryService.getByModel(model);
        return list;
    }

    @RequestMapping(value = "/getByPId.json", method = RequestMethod.GET)
    @ResponseBody
    public List<Dictionary> getByPId(Integer pid) {
        List<Dictionary> list = dictionaryService.getByPId(pid);
        return list;
    }

    @RequestMapping(value = "/getByModelAndCode.json", method = RequestMethod.GET)
    @ResponseBody
    public Dictionary getByModelAndCode(String model, String code) {
        Dictionary dictionary = dictionaryService.getByModelAndCode(model, code);
        return dictionary;
    }

    @RequestMapping(value = "/getChildrenByModelAndCode.json", method = RequestMethod.GET)
    @ResponseBody
    public List<Dictionary> getChildrenByModelAndCode(String model, String code) {
        List<Dictionary> list = dictionaryService.getChildrenByModelAndCode(model, code);
        return list;
    }

}
